package com.changcheng.mapper;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ArticleTypeMapper {
    @Select("select name from article_type")
    List<String> findAllArticleType();

    //select2
    @Select("select name from article_type where name = #{name}")
    String findArticleType(String name);
    //add
    @Insert("insert into article_type(name) value(#{name})")
    void add(String name);

    //update
    @Update("update article_type set name = 'man' where name = #{name}")
    void update(String name);
    //delete
    @Delete("delete from article_type where name = #{name}")
    void delete(String name);
//article关联查询
    @Select("select name from article_type where id = #{id}")
    String selectItem(Integer id);

}
